/**  \file Page3.qml
\brief Page3 form management

Price My House for Nokia mobile platforms.

\author © 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
\author "Evimin Fiyati Price My House" is protected by the copyright law
\author Distributed under the LGPL 3.0 license.
\date 2011

\par Licensing notes

    "Price My House" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "Price My House" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "Price My House".
    If not, see <http://www.gnu.org/licenses/>.

*/

import QtQuick 1.0
import "../Qt-Complex" as Framework
import "../Qt-Complex/Geometry.js" as Geometry

Item {
    id: page3

    /*
        Page 3 has two modes with some fields shown/hidden. The properties to show/hide
        in the different modes are set by the two states "Apartment" or "Villa"
    */

    // Text labels contents
    property string txt1Label: ""; property string txt2Label: ""; property string txt3Label: ""
    property string txt4Label: "";
    // Field labels contents
    property string fld1: "";property string fld2: ""; property string fld3: ""; property string fld4: ""
    // Note text content
    property string txt1Note: ""
    // Signals
    signal txt1Click; signal txt2Click; signal txt3Click; signal txt4Click

    // pageState depends on the page 1 selection. It can be
    // 1 for apartment type or 2 for villa type
    property int pageState: 1

    Column {
        id: columnFields

        width: parent.width
        spacing: Geometry.getFieldSpacing();
        anchors.top: parent.top
        anchors.topMargin: Geometry.getSeparator() * 2;

        Framework.Loader {
            id: input_txt1
            width: parent.width;
            height: Geometry.getFieldHeight() * 2 + Geometry.getFieldSpacing(); obj_string: txt1Label;
            fontPoints: Geometry.getFontPoints(); theme: "PMH";  obj: "VerBtnText";
            obj_flag: false // do not set to object to input text.
            onClicked: { txt1Click(); }
        }
        Framework.Loader {
            id: input_txt2
            width: parent.width;
            height: Geometry.getFieldHeight() * 2 + Geometry.getFieldSpacing(); obj_string: txt2Label;
            fontPoints: Geometry.getFontPoints(); theme: "PMH";  obj: "VerBtnText";
            obj_flag: false // do not set to object to input text.
            onClicked: { txt2Click(); }
        }
        // This field is visibile only in pageState 1
        Framework.Loader {
            id: input_txt3
            width: parent.width;
            height: Geometry.getFieldHeight() * 2 + Geometry.getFieldSpacing(); obj_string: txt3Label;
            visible: (pageState == 1) ? true: false
            fontPoints: Geometry.getFontPoints(); theme: "PMH";  obj: "VerBtnText";
            obj_flag: false // do not set to object to input text.
            onClicked: { txt3Click(); }
        }
        // This field is visibile only in pageState 1
        Framework.Loader {
            id: input_txt4
            width: parent.width;
            height: Geometry.getFieldHeight() * 2 + Geometry.getFieldSpacing() * 2 + Geometry.getFieldSpacing();
            obj_string: txt4Label;
            visible: (pageState == 1) ? true: false
            fontPoints: Geometry.getFontPoints(); theme: "PMH";  obj: "VerBtnText";
            obj_flag: false // do not set to object to input text.
            onClicked: { txt4Click(); }
        }
        // This field is visibile only in pageState 2
        Text {
            id: note
            visible: (pageState == 2) ? true: false
            color: "#363636"; font.pointSize: Geometry.getFontPoints(); text: txt1Note
            wrapMode: Text.Wrap
        }
    }
}
